package com.hy.hello;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
@RabbitListener(queues="helloQueue")
public class HelloReceiver2 {
	
	Logger logger = LoggerFactory.getLogger(HelloReceiver2.class);
	
	public static int COUNT = 200;

    public static int cc = 0;

	@RabbitHandler
    public int process(String hello) throws InterruptedException {
        if(COUNT > 0){
//            System.out.println(COUNT);
            Thread.sleep(500);
            COUNT--;
        }
//        System.out.println("消费者处理  : " + COUNT+"条记录!");
        logger.info("HelloReceiver2>>>>>{}", ++cc);
        return COUNT;
    }

}
